import request from '@/http/request';

const getMemberCards = () => {
    return request({
        url: '/memcard/list',
        method: 'get'
    })
}

const getMemberCardById = (id) => {
    return request({
        url: '/memcard/findbyid',
        method: 'get',
        params: {
            id: id
        }
    })
}

const getMemberCardByName = (name) => {
    return request({
        url: '/memcard/findbyname',
        method: 'get',
        params: {
            name: name
        }
    })
}

const addMemberCard = (card) => {
    return request({
        url: '/memcard/save',
        method: 'post', 
        data: card
    })
}

const editMemberCard = (card) => {
    return request({
        url: '/memcard/update',
        method: 'put',
        data: card
    })
}

const deleteMemberCardById = (id) => {
    return request({
        url: '/memcard/delete/' + id,
        method: 'delete'
    })
}

export default {
    getMemberCards,
    getMemberCardById,
    getMemberCardByName,
    addMemberCard,
    editMemberCard,
    deleteMemberCardById
}
